cellrenderertoggle: Use the cell renderer's state flags as a base for rendering
authorRui Matos <tiagomatos@gmail.com>
Fri, 16 Dec 2011 19:49:31 +0000 (19:49 +0000)
committerRui Matos <tiagomatos@gmail.com>
Mon, 19 Dec 2011 19:21:15 +0000 (19:21 +0000)
This allows us to pick the underlying widget's state flags that we don't
explicitly set here.

gtk/gtkcellrenderertoggle.c

index 3b4a70ec1807c1396397bd7179923229a6e40afd..d75a5f8dc36c748260c7f29da157036ef6078113 100644 (file)
@@ -363,10 +363,12 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer      *cell,
   if (width <= 0 || height <= 0)
     return;
 
+  state = gtk_cell_renderer_get_state (cell, widget, flags);
+
   if (!priv->activatable)
-    state = GTK_STATE_FLAG_INSENSITIVE;
-  else
-    state = gtk_cell_renderer_get_state (cell, widget, flags);
+    state |= GTK_STATE_FLAG_INSENSITIVE;
+
+  state &= ~(GTK_STATE_FLAG_INCONSISTENT | GTK_STATE_FLAG_ACTIVE);
 
   if (priv->inconsistent)
     state |= GTK_STATE_FLAG_INCONSISTENT;